Skip to content

[VRF] Add duthost fixture parameter to TestVrfLoopbackIntf setup#2415

Merged
yxieca merged 1 commit intosonic-net:masterfrom
vboykox:fix_vrf
Nov 2, 2020
Merged

[VRF] Add duthost fixture parameter to TestVrfLoopbackIntf setup#2415
yxieca merged 1 commit intosonic-net:masterfrom
vboykox:fix_vrf

Conversation

@vboykox
Copy link
Member

@vboykox vboykox commented Oct 27, 2020

Signed-off-by: Volodymyr Boyko volodymyrx.boiko@intel.com

Description of PR

#2369 make use of duthost in TestVrfLoopbackIntf setup while there is no such fixture parameter in the setup function, adding the parameter.

Summary:
Fixes # (issue)

____________________________________________ ERROR at setup of TestVrfLoopbackIntf.test_ping_vrf1_loopback ____________________________________________

self = <test_vrf.TestVrfLoopbackIntf instance at 0x7f07aa150cf8>, ptfhost = <tests.common.devices.PTFHost object at 0x7f07af3c7790>
cfg_facts = {...}

    @pytest.fixture(scope="class", autouse=True)
    def setup_vrf_loopback(self, ptfhost, cfg_facts, tbinfo):
        # -------- Setup ----------
        lb0_ip_facts = get_intf_ips('Loopback0', cfg_facts)
        vlan1000_ip_facts = get_intf_ips('Vlan1000', cfg_facts)
        lb2_ip_facts = get_intf_ips('Loopback2', cfg_facts)
        vlan2000_ip_facts = get_intf_ips('Vlan2000', cfg_facts)
    
        self.c_vars['lb0_ip_facts'] = lb0_ip_facts
        self.c_vars['lb2_ip_facts'] = lb2_ip_facts
        self.c_vars['vlan1000_ip_facts'] = vlan1000_ip_facts
        self.c_vars['vlan2000_ip_facts'] = vlan2000_ip_facts
    
        # deploy routes to loopback
        for ver, ips in lb0_ip_facts.iteritems():
            for vlan_ip in vlan1000_ip_facts[ver]:
                nexthop = vlan_ip.ip
                break
            for ip in ips:
                ptfhost.shell("ip netns exec {} ip route add {} nexthop via {} ".format(g_vars['vlan_peer_vrf2ns_map']['Vrf1'], ip, nexthop))
    
        for ver, ips in lb2_ip_facts.iteritems():
            for vlan_ip in vlan2000_ip_facts[ver]:
                nexthop = vlan_ip.ip
                break
            for ip in ips:
                ptfhost.shell("ip netns exec {} ip route add {} nexthop via {} ".format(g_vars['vlan_peer_vrf2ns_map']['Vrf2'], ip, nexthop))
    
>       duthost.shell("sysctl -w net.ipv6.ip_nonlocal_bind=1")
E       NameError: global name 'duthost' is not defined

vrf/test_vrf.py:739: NameError

Type of change

  • [ x] Bug fix
  • Testbed and Framework(new/improvement)
  • Test case(new/improvement)

Approach

What is the motivation for this PR?

the bug introduced in #2369 pr

How did you do it?

just added the lacking parameter

How did you verify/test it?

did a run of the test

Any platform specific information?

none

Supported testbed topology if it's a new test case?

n/a

Documentation

n/a

Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com>
@vboykox
Copy link
Member Author

vboykox commented Oct 27, 2020

@vboykox
Copy link
Member Author

vboykox commented Oct 27, 2020

@wangxin

@vboykox
Copy link
Member Author

vboykox commented Oct 27, 2020

@lguohan

@Minkang-Tsai
Copy link
Contributor

@vboykox Could you meet error during the setup?

@vboykox
Copy link
Member Author

vboykox commented Oct 28, 2020

@Minkang-Tsai

____________________________________________ ERROR at setup of TestVrfLoopbackIntf.test_ping_vrf1_loopback ____________________________________________

self = <test_vrf.TestVrfLoopbackIntf instance at 0x7f07aa150cf8>, ptfhost = <tests.common.devices.PTFHost object at 0x7f07af3c7790>
cfg_facts = {...}

    @pytest.fixture(scope="class", autouse=True)
    def setup_vrf_loopback(self, ptfhost, cfg_facts, tbinfo):
        # -------- Setup ----------
        lb0_ip_facts = get_intf_ips('Loopback0', cfg_facts)
        vlan1000_ip_facts = get_intf_ips('Vlan1000', cfg_facts)
        lb2_ip_facts = get_intf_ips('Loopback2', cfg_facts)
        vlan2000_ip_facts = get_intf_ips('Vlan2000', cfg_facts)
    
        self.c_vars['lb0_ip_facts'] = lb0_ip_facts
        self.c_vars['lb2_ip_facts'] = lb2_ip_facts
        self.c_vars['vlan1000_ip_facts'] = vlan1000_ip_facts
        self.c_vars['vlan2000_ip_facts'] = vlan2000_ip_facts
    
        # deploy routes to loopback
        for ver, ips in lb0_ip_facts.iteritems():
            for vlan_ip in vlan1000_ip_facts[ver]:
                nexthop = vlan_ip.ip
                break
            for ip in ips:
                ptfhost.shell("ip netns exec {} ip route add {} nexthop via {} ".format(g_vars['vlan_peer_vrf2ns_map']['Vrf1'], ip, nexthop))
    
        for ver, ips in lb2_ip_facts.iteritems():
            for vlan_ip in vlan2000_ip_facts[ver]:
                nexthop = vlan_ip.ip
                break
            for ip in ips:
                ptfhost.shell("ip netns exec {} ip route add {} nexthop via {} ".format(g_vars['vlan_peer_vrf2ns_map']['Vrf2'], ip, nexthop))
    
>       duthost.shell("sysctl -w net.ipv6.ip_nonlocal_bind=1")
E       NameError: global name 'duthost' is not defined

vrf/test_vrf.py:739: NameError

@vboykox
Copy link
Member Author

vboykox commented Oct 29, 2020

@jleveque

@jleveque jleveque requested a review from wangxin October 29, 2020 01:49
@yxieca
Copy link
Collaborator

yxieca commented Oct 30, 2020

@vboykox please fill the PR template.

@vboykox
Copy link
Member Author

vboykox commented Oct 30, 2020

@yxieca done

@yxieca yxieca merged commit 207d50d into sonic-net:master Nov 2, 2020
kazinator-arista pushed a commit to kazinator-arista/sonic-mgmt that referenced this pull request Mar 4, 2026
…submodule head (sonic-net#11761)

linkmgrd:
* 476f85e 2022-08-17 | Update linkmgr health after getting default route update (sonic-net#117) (HEAD -> 202205, github/202205) [Longxiang Lyu]
* fc589e9 2022-08-17 | Use `table` to toggle peer forwarding state (sonic-net#108) (sonic-net#120) [Longxiang Lyu]
* bcb5a56 2022-08-17 | Fix azure pipeline (sonic-net#118) (sonic-net#121) [Longxiang Lyu]

swss:
* ef3a601 2022-08-17 | [muxorch] Returning true if nbr in skip_neighbor_ in isNeighborActive() (sonic-net#2415) (HEAD -> 202205) [Nikola Dancejic]

sairedis:
* aed01cd 2022-08-12 | Fix: missing sonic-db-cli in docker-sonic-vs image (sonic-net#1072) (sonic-net#1104) (github/202205) [Hua Liu]

platform-daemon:
* 5a68073 2022-08-01 | Xcvrd changes to support 400G ZR configuration (sonic-net#270) (HEAD -> 202205) [Prince George]

swsssdk:
* ca785a2 2022-06-01 | Remove sonic-db-cli (sonic-net#122) (HEAD -> 202205, origin/202205) [Hua Liu]

Signed-off-by: Ying Xie <ying.xie@microsoft.com>

Signed-off-by: Ying Xie <ying.xie@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants